/**
 * 企业相关接口
 */
import request from '../common/request.js'

// 获取企业列表
export function getCompanyList(params) {
  return request({
    url: '/xiaofu/company/list',
    method: 'GET',
    params
  })
}

// 根据ID获取企业详情
export function getCompanyDetail(companyId) {
  return request({
    url: `/xiaofu/company/${companyId}`,
    method: 'GET'
  })
}

// 获取企业评价维度列表
export function getRatingDimensions(params) {
  return request({
    url: '/xiaofu/ratingDimension/list',
    method: 'GET',
    params
  })
}

// 获取企业下的用户评价列表
export function getUserReviews(params) {
  return request({
    url: '/xiaofu/userReview/list',
    method: 'GET',
    params
  })
}

// 根据ID获取用户评价详情
export function getUserReviewDetail(id) {
  return request({
    url: `/xiaofu/userReview/${id}`,
    method: 'GET'
  })
}

// 获取企业评价维度数据/评分
export function getReviewRatings(params) {
  return request({
    url: '/xiaofu/reviewRating/list',
    method: 'GET',
    params
  })
}

// 获取企业下的所有评价维度对应的评分
export function getCompanyDimensionRatings(params) {
  return request({
    url: '/xiaofu/company/dimensionStatistics/list',
    method: 'GET',
    params
  })
}

// 获取企业的综合评分
export function getCompanyOverallScore(params) {
  return request({
    url: '/xiaofu/company/overallStatistics/list',
    method: 'GET',
    params
  })
}

// 创建用户评价
export function createUserReview(data) {
  return request({
    url: '/xiaofu/userReview',
    method: 'POST',
    data
  })
}

// 创建评价维度评分
export function createReviewRating(data) {
  return request({
    url: '/xiaofu/reviewRating',
    method: 'POST',
    data
  })
}

// 创建公司信息
export function createCompany(data) {
  return request({
    url: '/xiaofu/company',
    method: 'POST',
    data
  })
}